//
//  TimeKLineData.h
//  Chart
//
//  Created by CaoJun on 13-9-5.
//
//

#ifndef __Chart__TimeKLineData__
#define __Chart__TimeKLineData__

#include "KLineData.h"
#include "AVGData.h"

#include <string>

namespace ytx {
    
    class TimeKLineData;
    
    class AVGDataHandlerOfKLineData : public Observer<AVGData>
    {
    private:
        TimeKLineData & kLineData;
    public:
        virtual void handle(AVGData * avgData, std::string eventName, void * data);
        AVGDataHandlerOfKLineData(TimeKLineData & kLineData);
    };
    
    class TimeKLineData : public KLineData{
        
    public:
        TimeKLineData(std::string id, std::string currentDate, LineType::LineType quotationType, std::string marketType, int toFix, std::string name, std::string nickName, bool hasVolume, int limit, int threshold, int buffer, YTXTime tradedate, AVGData * avgData);
        
        ~TimeKLineData();
        
        AVGData * avgData;
        
        virtual void listenOn();
        
        virtual void listenOff();
        
        virtual bool checkNeedGetNewK();
        
        virtual void getCloseNewK();
        
        virtual bool isInLatestNewK(YTXTime tradedate1, YTXTime tradedate2);
        
        virtual void intervalRequestDataInterface();
        virtual void calculateTodayKLine();
    protected:
        AVGDataHandlerOfKLineData dataHandler;
        
        
    };
}

#endif /* defined(__Chart__TimeKLineData__) */
